package com.project.springboot.controller;

import com.gitee.yongzhuzl.commonutil.util.result.ResponseResult;
import com.project.springboot.entity.Student;
import com.project.springboot.service.StudentService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.concurrent.ExecutionException;

/**
 * description: 测试缓存
 * @author 朱正磊
 * @date 2025-05-13 15:31:20
 */
@RestController
@RequestMapping("/cache")
public class CacheController {

    @Resource
    private StudentService studentService;

    /**
     * description: 根据姓名模糊查询学生集合
     * @author 朱正磊
     * @date 2025-05-13 15:45:42
     * @param name 姓名
     * @return 返回学生集合
     */
    @GetMapping("/testCache")
    public ResponseResult<List<Student>> testCache(String name) throws ExecutionException {
        List<Student> list = studentService.testCache(name);
        return ResponseResult.buildSuccess(list);
    }

}
